//   Copyright 2012,2013 Vaughn Vernon
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.

package com.saasovation.agilepm.domain.model.product;

import java.util.Date;

import com.saasovation.agilepm.domain.model.product.release.ReleaseId;
import com.saasovation.agilepm.domain.model.tenant.TenantId;
import com.saasovation.common.domain.model.DomainEvent;

/**
 * @领域事件： 产品发布已预定
 */
public class ProductReleaseScheduled implements DomainEvent {

    /**
     * 开始日期
     */
    private Date begins;
    /**
     * 内容描述
     */
    private String description;
    /**
     * 事件版本
     */
    private int eventVersion;
    /**
     * 结束日期
     */
    private Date ends;
    /**
     * 产品发布已预定名
     */
    private String name;
    /**
     * 发生日期
     */
    private Date occurredOn;
    /**
     * 产品ID
     */
    private ProductId productId;
    /**
     * 发布ID
     */
    private ReleaseId releaseId;
    /**
     * 租户ID
     */
    private TenantId tenantId;

    /**
     * 由以下参数构造产品发布已预定
     * @param aTenantId         租户ID
     * @param aProductId        产品ID
     * @param aReleaseId        发布ID
     * @param aName             产品发布已预订名
     * @param aDescription      内容描述
     * @param aBegins           开始日期
     * @param anEnds            结束日期
     */
    public ProductReleaseScheduled(
            TenantId aTenantId,
            ProductId aProductId,
            ReleaseId aReleaseId,
            String aName,
            String aDescription,
            Date aBegins,
            Date anEnds) {
        // 调用父类的默认构造器
        super();

        this.begins = aBegins;
        this.description = aDescription;
        // 事件版本 设定为1
        this.eventVersion = 1;
        this.ends = anEnds;
        this.name = aName;
        this.occurredOn = new Date();
        this.productId = aProductId;
        this.releaseId = aReleaseId;
        this.tenantId = aTenantId;
    }

    /**
     * 获取开始日期
     * @return  返回开始日期
     */
    public Date begins() {
        return this.begins;
    }

    /**
     * 获取内容描述
     * @return  返回内容描述
     */
    public String description() {
        return this.description;
    }

    /**
     * 获取结束日期
     * @return  返回结束日期
     */
    public Date ends() {
        return this.ends;
    }

    /**
     * 获取事件版本（覆盖）
     * @return  返回事件版本
     */
    @Override
    public int eventVersion() {
        return this.eventVersion;
    }

    /**
     * 获取产品发布已发布名
     * @return  返回产品发布已发布名
     */
    public String name() {
        return this.name;
    }

    /**
     * 获取发生日期
     * @return  返回发生日期
     */
    @Override
    public Date occurredOn() {
        return this.occurredOn;
    }

    /**
     * 获取产品ID
     * @return  返回产品ID
     */
    public ProductId productId() {
        return this.productId;
    }

    /**
     * 获取发布ID
     * @return  返回发布ID
     */
    public ReleaseId releaseId() {
        return this.releaseId;
    }

    /**
     * 获取租户ID
     * @return  返回租户ID
     */
    public TenantId tenantId() {
        return this.tenantId;
    }
}
